/*
 * Title: 生成元
 * Author: Yuanshun L
 * Created: 28-Sep-2021
 */
#include<stdio.h>
#include<string.h>
#define MAXN 100001
#define EDGE 100000
int res[MAXN];
int main() {
    int sum = 0;
    int x,n,t;
    memset(res,0,sizeof(res));

    for(int i=1;i<=EDGE;i++){
        x = i;
        sum = 0;
        while(x>0){
            sum += x%10;
            x/=10;
        }
        if(res[i+sum]==0)
            res[i+sum]=i;
    }
    printf("The number of Digit Generator: ");
    scanf("%d", &n);
    while(n--){
        scanf("%d",&t);
        printf("%d\n",res[t]);
    }
    return 0;
}
